stage.set_axis(8)
stage.create_grid_overlay(1, "black")
hat = codesters.Sprite("fleecehat", 5, -6)
hat.turn_right(75)
hat.set_size(.5)
flake1 = codesters.Sprite("snowflake1", 5, 1)
flake1.set_size(.5)
flake2 = codesters.Sprite("snowflake2", 0, 6)
flake2.set_size(.5)
flake3 = codesters.Sprite("snowflake3", -7, 2)
flake3.set_size(.5)
# sweater = codesters.Sprite("sweater", -7, -4)
# sweater.turn_left(80)
# sweater.set_size(.5)
stage.set_background("winter")
sprite = codesters.Sprite("snowman")
sprite.set_size(.5)
sprite.pen_down()
sprite.glide_to(5, -6)
def collision(sprite, hit_sprite):
hit_sprite.hide()
# add any other actions...
sprite.event_collision(collision)
sprite.glide_to(5, 1)
sprite.glide_to(0, 6)
t = codesters.Teacher()
glides = t.find_function('glide_to')
try:
tval1 = glides[3][1].replace(' ', '')
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success('-7,2' in tval1, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a third Glide To command?")
t1.add_failure(len(glides) != 4, "Make sure you're using 4 Glide To commands!")
t1.add_failure('2,-7' in tval1, "Oops! Did you mix up the x and y coordintates?")
t1.add_failure('-7,2' not in tval1, "Oops! Make sure you're sending the sprite to (-7, 2)!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)